package com.yoga.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yoga.dao.ClassroomMapper;
import com.yoga.model.Classroom;
import com.yoga.service.ClassroomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author yan
 * @date 2025/8/16
 */
@Service
public class ClassroomServiceImpl implements ClassroomService {

    private ClassroomMapper classroomMapper;
    @Autowired
    public void setClassroomMapper(ClassroomMapper classroomMapper) {
        this.classroomMapper = classroomMapper;
    }

    @Override
    public Page<Classroom> searchAll(Page<Classroom> page, Classroom classroom) {
        return classroomMapper.searchAll(page,classroom);
    }

    @Override
    public int deleteById(List<Integer> ids) {
        return classroomMapper.deleteByIds(ids);
    }

    @Override
    public boolean add(Classroom classroom) {
        return classroomMapper.insert(classroom)>0;
    }

    @Override
    public boolean update(Classroom classroom) {
        return classroomMapper.updateById(classroom)>0;
    }

    @Override
    public List<Classroom> findAll() {
        return classroomMapper.selectList(null);
    }

}
